Use [abyx_svcm]
GO

--[SP_SVC_CustomersGet]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_CustomersGet]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_CustomersGet]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_CustomersGet]    Script Date: 2012-09-07 13:24 ******/
CREATE PROCEDURE [dbo].[SP_SVC_CustomersGet]
	 @CustomerId uniqueidentifier
AS
BEGIN
	SELECT * FROM [SVC_Customers] WHERE [CustomerId]=@CustomerId
	RETURN @@error
END
GO

--[SP_SVC_CustomersInsert]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_CustomersInsert]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_CustomersInsert]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_CustomersInsert]    Script Date: 2012-09-07 13:24 ******/
CREATE PROCEDURE [SP_SVC_CustomersInsert]
	 @CustomerId uniqueidentifier	,@CustomerNo varchar(50)	,@IdType varchar(50)	,@IdNo varchar(50)	,@Name varchar(255)	,@Address varchar(255)	,@Tel varchar(255)	,@Mob varchar(255)	,@LMUserId uniqueidentifier	,@LMDate datetimeAS
BEGIN
	INSERT INTO [SVC_Customers]
		 VALUES( @CustomerId,@CustomerNo,@IdType,@IdNo,@Name,@Address,@Tel,@Mob,@LMUserId,@LMDate)
	RETURN @@error
END
GO

--[SP_SVC_CustomersUpdate]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_CustomersUpdate]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_CustomersUpdate]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_CustomersUpdate]    Script Date: 2012-09-07 13:24 ******/
CREATE PROCEDURE [dbo].[SP_SVC_CustomersUpdate]
	 @CustomerId uniqueidentifier	,@CustomerNo varchar(50)	,@IdType varchar(50)	,@IdNo varchar(50)	,@Name varchar(255)	,@Address varchar(255)	,@Tel varchar(255)	,@Mob varchar(255)	,@LMUserId uniqueidentifier	,@LMDate datetimeAS
BEGIN
	UPDATE [SVC_Customers]
	   SET
			 [CustomerNo] = @CustomerNo			,[IdType] = @IdType			,[IdNo] = @IdNo			,[Name] = @Name			,[Address] = @Address			,[Tel] = @Tel			,[Mob] = @Mob			,[LMUserId] = @LMUserId			,[LMDate] = @LMDate	WHERE [CustomerId] = @CustomerId
	RETURN @@error
END
GO

--[SP_SVC_CustomersDelete]
IF  EXISTS (SELECT * 
			FROM dbo.sysobjects 
			WHERE id = OBJECT_ID(N'[SP_SVC_CustomersDelete]') 
			AND OBJECTPROPERTY(id,N'IsProcedure') = 1)
	DROP PROCEDURE [SP_SVC_CustomersDelete]
GO
/****** Object:  StoredProcedure [dbo].[SP_SVC_CustomersDelete]    Script Date: 2012-09-07 13:24 ******/
CREATE PROCEDURE [dbo].[SP_SVC_CustomersDelete]
	@CustomerId uniqueidentifier
AS
BEGIN
	DELETE FROM [SVC_Customers] WHERE [CustomerId]=@CustomerId
	RETURN @@error
END
Go

